home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / liberatr.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  925b  |  51 lines

  1. /***************************************************************************
  2.  
  3.   liberator.c - 'machine.c'
  4.  
  5.   Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
  6.   I/O ports)
  7.  
  8. ***************************************************************************/
  9.  
  10. #include "driver.h"
  11.  
  12.  
  13. UINT8 *liberatr_ctrld;
  14.  
  15.  
  16. WRITE_HANDLER( liberatr_led_w )
  17. {
  18.     osd_led_w(offset, (data >> 4) & 0x01);
  19. }
  20.  
  21.  
  22. WRITE_HANDLER( liberatr_coin_counter_w )
  23. {
  24.     coin_counter_w(offset ^ 0x01, data);
  25. }
  26.  
  27.  
  28. READ_HANDLER( liberatr_input_port_0_r )
  29. {
  30.     int    res ;
  31.     int xdelta, ydelta;
  32.  
  33.  
  34.     /* CTRLD selects whether we're reading the stick or the coins,
  35.        see memory map */
  36.  
  37.     if(*liberatr_ctrld)
  38.     {
  39.         /*     mouse support */
  40.         xdelta = input_port_4_r(0);
  41.         ydelta = input_port_5_r(0);
  42.         res = ( ((ydelta << 4) & 0xf0)  |  (xdelta & 0x0f) );
  43.     }
  44.     else
  45.     {
  46.         res = input_port_0_r(offset);
  47.     }
  48.  
  49.     return res;
  50. }
  51.